#include "HelpDialog.h"

HelpDialog::HelpDialog()
{
    layout_main = new QGridLayout;   //主布局

    label_version1 = new QLabel();
    label_version2 = new QLabel();
    label_author1 = new QLabel();
    label_author2 = new QLabel();
    label_source1 = new QLabel();
    label_source2 = new QLabel();
    label_info1 = new QLabel();
    label_info2 = new QLabel();
}

HelpDialog::~HelpDialog()
{
    delete label_info2;
    delete label_info1;
    delete label_source2;
    delete label_source1;
    delete label_author2;
    delete label_author1;
    delete label_version2;
    delete label_version1;

    delete layout_main;
}

void HelpDialog::init_view_main()
{
    setFixedSize(380, 160);
    setWindowTitle("帮助");

    layout_main->setSpacing(2);    //设置控件距离
    setLayout(layout_main);

    label_version1->setStyleSheet("QLabel{font:12px;padding: 5px 15px 5px 15px;}");
    label_version2->setStyleSheet("QLabel{font:12px;padding: 5px 15px 5px 15px;}");
    label_author1->setStyleSheet("QLabel{font:12px;padding: 5px 15px 5px 15px;}");
    label_author2->setStyleSheet("QLabel{font:12px;padding: 5px 15px 5px 15px;}");
    label_source1->setStyleSheet("QLabel{font:12px;padding: 5px 15px 5px 15px;}");
    label_source2->setStyleSheet("QLabel{font:12px;padding: 5px 15px 5px 15px;}");
    label_info1->setStyleSheet("QLabel{font:12px;padding: 5px 15px 5px 15px;}");
    label_info2->setStyleSheet("QLabel{font:12px;padding: 5px 15px 5px 15px;}");

    label_version1->setText("版本号：");
    label_author1->setText("作者：");
    label_source1->setText("源码地址：");
    label_info1->setText("说明：");

    label_version2->setText(VERSION);
    label_author2->setText(AUTHOR);
    label_source2->setText(SOURCE);
    label_info2->setText(INFO);

    layout_main->addWidget(label_version1, 0, 0);
    layout_main->addWidget(label_version2, 0, 1);
    layout_main->addWidget(label_author1, 1, 0);
    layout_main->addWidget(label_author2, 1, 1);
    layout_main->addWidget(label_source1, 2, 0);
    layout_main->addWidget(label_source2, 2, 1);
    layout_main->addWidget(label_info1, 3, 0);
    layout_main->addWidget(label_info2, 3, 1);

}
